package com.cqw.commontest.io;


import java.io.*;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-04-25 17:40
 * @Description: 字符流
 */
public class FileReaderTest {


    /**
     * FileReader   (只能读取用记事本打开的文本文件)
     * 1、可以处理中文
     * 2、不能处理图片
     */
    public static void main(String[] args) {
        try {
            FileReader fileReader = new FileReader(new File("D:\\fileTest\\1.xlsx"));
            FileWriter fileWriter = new FileWriter(new File("D:\\fileTest\\2.xlsx"));

            char[] chars = new char[1024];
            int len;
            while ((len = fileReader.read(chars)) != -1) {
                fileWriter.write(chars, 0, len);
            }
            fileReader.close();
            fileWriter.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {

        }


    }


}
